package com.cq.hd.member.service.impl;

import com.cq.hd.common.pagination.Page;
import com.cq.hd.member.api.dto.AdminSubsidyAmtBillPageDto;
import com.cq.hd.member.api.dto.SubsidyAmtBillDto;
import com.cq.hd.member.api.vo.AdminSubsidyAmtBillPageVo;
import com.cq.hd.member.api.vo.SubsidyAmtBillPageVo;
import com.cq.hd.member.po.TbSubsidyAmtBillPo;
import com.cq.hd.member.mapper.TbSubsidyAmtBillMapper;
import com.cq.hd.member.service.TbSubsidyAmtBillService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 补贴金流水表 服务实现类
 * </p>
 *
 * @author mYunYu
 * @since 2024-01-28
 */
@Service
public class TbSubsidyAmtBillServiceImpl extends ServiceImpl<TbSubsidyAmtBillMapper, TbSubsidyAmtBillPo> implements TbSubsidyAmtBillService {

    @Override
    public List<SubsidyAmtBillPageVo> listSubsidyAmtBill(SubsidyAmtBillDto subsidyAmtBillDto) {
        return baseMapper.listSubsidyAmtBill(subsidyAmtBillDto);
    }

    @Override
    public Page<AdminSubsidyAmtBillPageVo> pageSubsidyAmtBill(AdminSubsidyAmtBillPageDto adminSubsidyAmtBillPageDto) {
        PageHelper.startPage(adminSubsidyAmtBillPageDto.getPageNum(), adminSubsidyAmtBillPageDto.getPageSize());
        List<AdminSubsidyAmtBillPageVo> adminSubsidyAmtBillPageVos = baseMapper.listSubsidyAmtBillByDto(adminSubsidyAmtBillPageDto);
        PageInfo<AdminSubsidyAmtBillPageVo> pageInfo = new PageInfo<>(adminSubsidyAmtBillPageVos);
        return Page.newPageWithAllFields(pageInfo.getList(), pageInfo.getPageNum(), pageInfo.getPageSize(), pageInfo.getTotal(), pageInfo.getPages());
    }
}
